<?php

use yii\db\Migration;
use \yii\helpers\Console;
use common\models\MktPost;
use common\models\MktUser;

class m161012_093257_create_demo_data extends Migration
{
    public function up()
    {
        $tableOptions = null;
        if ($this->db->driverName === 'mysql') {
            // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=myisam';
        }
    
        $faker = \Faker\Factory::create('zh_CN');

        $this->createTable('mkt_template_id', [
            'gh_id' => $this->string(64)->notNull(),
            'template_id_short' => $this->string(32)->notNull(),
            'template_id' => $this->string(128)->notNull(),
        ], $tableOptions);

        /*
        ALTER TABLE mkt_source_member CHANGE member_area_id area_id int(10) unsigned NOT NULL DEFAULT 0 COMMENT '会员区域';
        ALTER TABLE mkt_source_service CHANGE service_area_id area_id int(10) unsigned NOT NULL DEFAULT 0 COMMENT '服务区域';
        ALTER TABLE mkt_source_promotion CHANGE promotion_fan_area area_id int(10) unsigned NOT NULL DEFAULT 0 COMMENT '粉丝区域';
        ALTER TABLE mkt_source_donate CHANGE donate_area area_id int(10) unsigned NOT NULL DEFAULT 0 COMMENT '赞助区域';
        ALTER TABLE mkt_source_room CHANGE room_area_id area_id int(10) unsigned NOT NULL DEFAULT 0 COMMENT '场地区域';

        ALTER TABLE mkt_source_donate ADD donate_reward int(10) unsigned NOT NULL DEFAULT 0 COMMENT '赞助回报';        
        ALTER TABLE mkt_source_service ADD service_type int(10) unsigned NOT NULL DEFAULT 0 COMMENT '服务类型';                
        */

        //$this->dropIndex('idx_post_id_user_id', 'mkt_post_complain');
        //$this->addColumn('mkt_chat', 'cat', $this->integer()->notNull()->defaultValue(0));
        //$this->addColumn('mkt_chat', 'approved', $this->integer()->notNull()->defaultValue(0));
        $this->alterColumn('mkt_post', 'start_time', $this->dateTime());
        $this->alterColumn('mkt_post', 'end_time', $this->dateTime());
        $this->alterColumn('mkt_post', 'cooperation_reward', $this->integer()->notNull()->defaultValue(0));
        $this->alterColumn('mkt_gold', 'amount', $this->integer()->notNull()->defaultValue(0));
        $this->dropIndex('idx_user_id', 'mkt_gold');
        $this->createIndex('idx_user_id', 'mkt_gold', 'user_id');

        define('USER_COUNT', 101);
        define('POST_COUNT', 201);
        $areaIds = [11, 12, 21];
        $industryIds = [11, 12, 21];
        $duties = ['工程师', '教师', '律师', '市场总监', '总经理', '人事经理', '行政', '地推', '司机', '董事长', '经理助理', '销售经理', '销售代表'];
        $provinces = ['湖北', '淅江', '北京', '上海', '广东', '云南', '辽宁'];
        $headImages = [
//            'http://wx.qlogo.cn/mmopen/bukTcfA7tGNlRTkCJeJhxJ24qStyhb0nbJX2Hz2hNFYCzLR4sK6tIF2Ticiatib3otM85qiaMGPHqYricwHkTIkwI3hH4ibYdicUjfo/0',
            'http://wx.qlogo.cn/mmopen/o73jnmGjskGw7XpceM1uu3o0jeobrFy09zjzUY2vAotpFSItH1oxdP7DYxia5fTWicLq2K0IbhdqQY3aaZCNpZec8JSO7gY9kl/0',
            'http://wx.qlogo.cn/mmopen/mGSJ4XtqibpMzvddRRQicKXVLfouibxsJmznxBlEKQwXHzY7PyfTsb9YCkxHIeLMB7reFL43ZS0Jg1Bwib0rjPibCIQIb9yThOAZI/0',
            'http://wx.qlogo.cn/mmopen/Nztsu1yeYtETC9ssMAlcE8hRlst8GSL3iaEIGPMzENIGUrepArr1zabJnohpeibW6y9K8VvHvSZubaoWPLReEc98x8Kmvth93v/0',
            'http://wx.qlogo.cn/mmopen/o73jnmGjskGw7XpceM1uuzPcaM6aF1yqbpEz0kANdTqxIW27gicCfPYKYySP1W2f2xGnEyiaU1kHqRNfgwqUq4AgcxegG5JlB2/0',
            'http://wx.qlogo.cn/mmopen/buW4fOMr8CUicDjK4x5IiaT0Nbcuzem0icOjia4Q2YyjUtcCjFgsCDUsSz5joOfmPrMTYVGjTYoCObzZrsia1AR0jC5wq2QAialXVia/0',
            'http://wx.qlogo.cn/mmopen/h2t6ojR29jJaLD4xzgDLeDG197iahRyianpOtyc3o2zMw2ibyg1b8ufC6ic9RGazpprucO3E9A48rLknMRbmL3ibAXMD3xWSKibI62/0',
            'http://wx.qlogo.cn/mmopen/Uf2Tkt1hetGliaFhJPGqIk23ZyE0Y7AFCmefYQAbic2yNRdjO0ZsepFlWA2CHUcewXsqdGIQ0q5nvCIxVJmkAUFzORhqraI5Mp/0',
            'http://wx.qlogo.cn/mmopen/Uf2Tkt1hetFTF0fKJevgffvEWMHN9G3Qk2bRqMuXkrKy4wTyezS8icYxHgAAQEqVtJzoFLqd1DeKfc8wk4XVrrFHtaxz78L9ib/0',
            'http://wx.qlogo.cn/mmopen/mbpRbgPCu8c7v7owFlzT1vlwZU8dmDLOlibmr3xEkNxxQ06fHmm1levlvSKZLqNGVkSkj8XeGbCXNGJicgdaWDx3C7Rwiccx7Ww/0',
            'http://wx.qlogo.cn/mmopen/Q3auHgzwzM7VexiauicXZzsaUYjicxw1oTria4SN54OoktRCY86HqF4Iqn3bv8WVwQ6F0HAz7KicZZUOIicrVCMhb78A/0',
            'http://wx.qlogo.cn/mmopen/mbpRbgPCu8cTXQRoibz64h4NTtgM2ecrUVwhZ7mbLJOlHEu6K3oBicaks7C5qATwhXJOQXib752We34N5bqV3ibEqf3Z6WB4Gymz/0',
            'http://wx.qlogo.cn/mmopen/o73jnmGjskFffliaIKk1ialX2WF7cafLiaSzKicvammCmjAvBLkTagwQYOHqBfIMYS0207MK1icwVZ8arREa4VxOdAiaXAKWUZ5OWA/0',
            'http://wx.qlogo.cn/mmopen/PiajxSqBRaEL1l9WVUg63NbDZib6NpqtTRzPEudH9WufrWNVuFvyzSWt6Vic6cicUYCqyODEoFo0K18Pg19zibP963g/0',
            'http://wx.qlogo.cn/mmopen/o73jnmGjskGkI8h2iaxEVfh30cpx9c7Z3O9RJ571adWMdQyibwMYcAgMhlzC6No4SbYv2ic9H7wdBic7KmH0PF4Lnu5PXYsVMaW4/0',
            'http://wx.qlogo.cn/mmopen/X4XEGYefSBTicV6Od5BXXSsib6x0heEgYAYYCw0qTQLZj6iaBPpWkkmiaksqWwaXYf0nATYuAkr4C1QbDvtgCRptGefUiaIiciatibHG/0',
            'http://wx.qlogo.cn/mmopen/o73jnmGjskFyyVIUqiafIqUFAf3KtzloanlSmcCQeo10WXTaw9wjLvcGOmSibxyomhPRTsOOsgMNfeMicQcWPkPSRn5viaDR6esv/0',
            'http://wx.qlogo.cn/mmopen/Nztsu1yeYtETC9ssMAlcE4Qfa5qaOU7H9o26eJJiaNsrGyhLkzteUflZogej8O644Jib1sibBARH6e26n8jZBacqPgk5DELWKy8/0',
        ];
        $cooperationTitles = [
            '教育机构',
            '会议场地',
            '资金',
            '宾馆酒店',
        ];

        if (\yii\helpers\Console::confirm("\n是否创建demo数据:")) {
            $this->truncateTable('mkt_industry');
            $this->alterColumn('mkt_industry', 'id', $this->integer()->unsigned()->comment('ID'));
            $this->dropPrimaryKey('PRIMARY', 'mkt_industry');
            $this->createIndex('idx_id', 'mkt_industry', 'id', true);

            $row = new common\models\MktIndustry;
            $row->setAttributes([
                'id' => 1,
                'parent_id' => 0,
                'title' => '教育',
            ], false);
            echo "\n insert MktIndustry " . ($row->save(false) ? 'ok' : 'err' . print_r($row->getErrors(), true)) . "\n";

            $row = new common\models\MktIndustry;
            $row->setAttributes([
                'id' => 2,
                'parent_id' => 0,
                'title' => '科技',
            ], false);
            echo "\n insert MktIndustry " . ($row->save(false) ? 'ok' : 'err' . print_r($row->getErrors(), true)) . "\n";

            $row = new common\models\MktIndustry;
            $row->setAttributes([
                'id' => 11,
                'parent_id' => 1,
                'title' => '小学',
            ], false);
            echo "\n insert MktIndustry " . ($row->save(false) ? 'ok' : 'err' . print_r($row->getErrors(), true)) . "\n";

            $row = new common\models\MktIndustry;
            $row->setAttributes([
                'id' => 12,
                'parent_id' => 1,
                'title' => '中学',
            ], false);
            echo "\n insert MktIndustry " . ($row->save(false) ? 'ok' : 'err' . print_r($row->getErrors(), true)) . "\n";

            $row = new common\models\MktIndustry;
            $row->setAttributes([
                'id' => 21,
                'parent_id' => 2,
                'title' => '互联网',
            ], false);
            echo "\n insert MktIndustry " . ($row->save(false) ? 'ok' : 'err' . print_r($row->getErrors(), true)) . "\n";

            $this->dropIndex('idx_id', 'mkt_industry');
            $this->alterColumn('mkt_industry', 'id', $this->primaryKey()->unsigned()->comment('ID') . ' NOT NULL AUTO_INCREMENT');

            // --------------------------------------------

            $this->truncateTable('mkt_area');
            $this->alterColumn('mkt_area', 'id', $this->integer()->unsigned()->comment('ID'));
            $this->dropPrimaryKey('PRIMARY', 'mkt_area');
            $this->createIndex('idx_id', 'mkt_area', 'id', true);

            $row = new common\models\MktArea;
            $row->setAttributes([
                'id' => 1,
                'parent_id' => 0,
                'title' => '江汉区',
            ], false);
            echo "\n insert MktArea " . ($row->save(false) ? 'ok' : 'err' . print_r($row->getErrors(), true)) . "\n";

            $row = new common\models\MktArea;
            $row->setAttributes([
                'id' => 2,
                'parent_id' => 0,
                'title' => '关山区',
            ], false);
            echo "\n insert MktArea " . ($row->save(false) ? 'ok' : 'err' . print_r($row->getErrors(), true)) . "\n";

            $row = new common\models\MktArea;
            $row->setAttributes([
                'id' => 11,
                'parent_id' => 1,
                'title' => '江汉路步行街',
            ], false);
            echo "\n insert MktArea " . ($row->save(false) ? 'ok' : 'err' . print_r($row->getErrors(), true)) . "\n";

            $row = new common\models\MktArea;
            $row->setAttributes([
                'id' => 12,
                'parent_id' => 1,
                'title' => '武汉关商圈',
            ], false);
            echo "\n insert MktArea " . ($row->save(false) ? 'ok' : 'err' . print_r($row->getErrors(), true)) . "\n";

            $row = new common\models\MktArea;
            $row->setAttributes([
                'id' => 21,
                'parent_id' => 2,
                'title' => '光谷广场附近',
            ], false);
            echo "\n insert MktArea " . ($row->save(false) ? 'ok' : 'err' . print_r($row->getErrors(), true)) . "\n";

            $this->dropIndex('idx_id', 'mkt_area');
            $this->alterColumn('mkt_area', 'id', $this->primaryKey()->unsigned()->comment('ID') . ' NOT NULL AUTO_INCREMENT');

            //插入资源会员表数据-----------------------------
            for ($i = 0; $i < 10; $i++) {
                $row = new common\models\MktSourceMember;
                $row->setAttributes([
                    'user_id' => rand(1, 10),
                    'area_id' => $areaIds[array_rand($areaIds)],
                    'member_count' => rand(100, 5000),
                    'member_quanlity' => rand(1000, 5000),
                    'member_age_min' => rand(20, 35),
                    'member_age_max' => rand(36, 65),
                ], false);
                echo "\n insert MktSourceMember " . ($row->save(false) ? 'ok' : 'err' . print_r($row->getErrors(), true)) . "\n";
            }

            //插入场地资源表数据-----------------------------
            for ($i = 0; $i < 10; $i++) {
                $row = new common\models\MktSourceRoom;
                $row->setAttributes([
                    'user_id' => rand(1, 10),
                    'area_id' => $areaIds[array_rand($areaIds)],
                    'room_type' => rand(1, 7),
                    'room_capacity_min' => rand(0, 100),
                    'room_capacity_max' => rand(101, 10000),
                ], false);
                echo "\n insert MktSourceRoom " . ($row->save(false) ? 'ok' : 'err' . print_r($row->getErrors(), true)) . "\n";
            }

            //插入礼品资源表数据-----------------------------
            for ($i = 0; $i < 10; $i++) {
                $row = new common\models\MktSourceGift;
                $row->setAttributes([
                    'user_id' => rand(1, 10),
                    'gift_type' => rand(1, 5),
                    'gift_count' => rand(1, 100),
                    'gift_price' => rand(100, 10000),
                ], false);
                echo "\n insert MktSourceGift " . ($row->save(false) ? 'ok' : 'err' . print_r($row->getErrors(), true)) . "\n";
            }

            //插入现金资源表数据-----------------------------
            for ($i = 0; $i < 10; $i++) {
                $row = new common\models\MktSourceDonate;
                $row->setAttributes([
                    'user_id' => rand(1, 10),
                    'donate_type' => rand(1, 3),
                    'donate_amount' => rand(100, 10000),
                    'area_id' => $areaIds[array_rand($areaIds)],
                ], false);
                echo "\n insert MktSourceDonate " . ($row->save(false) ? 'ok' : 'err' . print_r($row->getErrors(), true)) . "\n";
            }


            //插入 推广表数据-----------------------------
            for ($i = 0; $i < 10; $i++) {
                $row = new common\models\MktSourcePromotion;
                $row->setAttributes([
                    'user_id' => rand(1, 10),
                    'promotion_channel_id' => rand(1, 3),
                    'promotion_fan_industry' => $industryIds[array_rand($industryIds)],
                    'promotion_fan_count' => rand(100, 10000),
                    'area_id' => $areaIds[array_rand($areaIds)],
                ], false);
                echo "\n insert MktSourcePromotion " . ($row->save(false) ? 'ok' : 'err' . print_r($row->getErrors(), true)) . "\n";
            }

            //插入 服务表数据-----------------------------
            for ($i = 0; $i < 10; $i++) {
                $row = new common\models\MktSourceService;
                $row->setAttributes([
                    'user_id' => rand(1, 10),
                    'service_other' => rand(1, 3),
                    'service_device_rent' => rand(1, 3),
                    'service_talnet' => rand(1, 3),
                    'area_id' => $areaIds[array_rand($areaIds)],
                ], false);
                echo "\n insert MktSourceService " . ($row->save(false) ? 'ok' : 'err' . print_r($row->getErrors(), true)) . "\n";
            }

            //插入 投诉数据-----------------------------
            for ($i = 0; $i < 10; $i++) {
                $row = new common\models\MktPostComplain;
                $row->setAttributes([
                    'user_id' => rand(1, 10),
                    'post_id' => rand(1, POST_COUNT),
                    'reason' => rand(0, 4),
                ], false);
                echo "\n insert MktPostComplain " . ($row->save(false) ? 'ok' : 'err' . print_r($row->getErrors(), true)) . "\n";
            }

            //插入 建议数据-----------------------------
            for ($i = 0; $i < 10; $i++) {
                $row = new common\models\MktFeedback;
                $row->setAttributes([
                    'user_id' => rand(1, 10),
                    'content' => '这是一条建议记录-' . $i,
                ], false);
                echo "\n insert MktFeedback " . ($row->save(false) ? 'ok' : 'err' . print_r($row->getErrors(), true)) . "\n";
            }


            // 用户数据 --------------------------------------------
            $this->truncateTable('mkt_user');
            $this->alterColumn('mkt_user', 'id', $this->integer()->unsigned()->comment('ID'));
            $this->dropPrimaryKey('PRIMARY', 'mkt_user');
            //$this->createIndex('idx_id', 'mkt_user', 'id', true);

            for ($i = 1; $i <= USER_COUNT; $i++) {
                $model = new common\models\MktUser;
                $model->loadDefaultValues();
                $model->setAttributes([
                    'id' => $i,
                    'industry_id' => $industryId = $industryIds[array_rand($industryIds)],
                    'area_id' => $areaId = $areaIds[array_rand($areaIds)],
                    'company' => $faker->company,
                    'duty' => YII_ENV_DEV ? $duties[array_rand($duties)] . "-ID($i)-industryId($industryId)-areaId($areaId)" : $duties[array_rand($duties)],
                    'mobile' => $faker->phoneNumber,
                    'weixin_number' => 'weixin_number-' . $i,
                    'gh_id' => 'gh_8510652496c4',
                    'openid' => Yii::$app->getSecurity()->generateRandomString(),
                    'subscribe' => \common\wosotech\Util::haveProbability(100000) ? 0 : 1,
                    'nickname' => $faker->word,
                    'name' => $faker->firstName . $faker->lastName,
                    'sex' => rand(0, 1),
                    'email' => $faker->email,
                    'qq' => \common\wosotech\Util::haveProbability(400000) ? $faker->phoneNumber : '',
                    'headimgurl' => $headImages[array_rand($headImages)],
                    'city' => $faker->city,
                    'country' => '中国',
                    'province' => $provinces[array_rand($provinces)],

                ], false);
                echo "\n insert mkt_user " . ($model->save(false) ? 'ok' : 'err:' . print_r($model->getErrors(), true)) . "\n";
            }

            //$this->dropIndex('idx_id', 'mkt_user');
            $this->alterColumn('mkt_user', 'id', $this->primaryKey()->unsigned()->comment('ID') . ' NOT NULL AUTO_INCREMENT');


            // 贴子数据 ---------------------------------------
            $this->truncateTable('mkt_post');
            $this->alterColumn('mkt_post', 'id', $this->integer()->unsigned()->comment('ID'));
            $this->dropPrimaryKey('PRIMARY', 'mkt_post');

            $cooperationRewardOptions = MktPost::getPostCooperationRewardOption();
            for ($i = 1; $i <= POST_COUNT; $i++) {
                $model = new common\models\MktPost;
                $model->loadDefaultValues();
                $model->id = $i;
                $model->user_id = rand(1, 10);
                $model->start_time = date("Y-m-d");
                $model->end_time = date("Y-m-d");
                $model->industry_id = $industryIds[array_rand($industryIds)];
                $model->area_id = $areaIds[array_rand($areaIds)];
                $model->status = \common\wosotech\Util::haveProbability(100000) ? MktPost::POST_STATUS_DRAFT : MktPost::POST_STATUS_NORMAL;
                $model->is_anoymous = rand(0, 1);
                $model->post_type = rand(common\models\MktPost::POST_TYPE_COOPERATION, common\models\MktPost::POST_TYPE_JOB);
                if ($model->post_type == common\models\MktPost::POST_TYPE_JOB) {
                    $model->title = "诚聘" . $duties[array_rand($duties)] . "-{$i}";
                    $model->content = "现{$model->title},有意者请联系本人";
                    $model->job_salary_min = rand(0, 4);
                    $model->job_salary_max = rand(5, 9);
                    $model->job_age_min = rand(0, 3);
                    $model->job_age_max = rand(4, 7);
                    $model->job_education = rand(0, 3);
                    $model->job_experience = rand(0, 4);
                } else {
                    $model->title = "寻" . $cooperationTitles[array_rand($cooperationTitles)] . "合作-{$i}";
                    $model->content = $model->title . ", 非诚勿扰";
                    $model->cooperation_reward = $cooperationRewardOptions[array_rand($cooperationRewardOptions)];
                }
                echo "\n insert mkt_post " . ($model->save(false) ? 'ok' : 'err:' . print_r($model->getErrors(), true)) . "\n";
            }
            $this->alterColumn('mkt_post', 'id', $this->primaryKey()->unsigned()->comment('ID') . ' NOT NULL AUTO_INCREMENT');

            // 回贴数据 ---------------------------------------
            $this->truncateTable('mkt_post_response');
            for ($i = 1; $i <= 100; $i++) {
                $model = new common\models\MktPostResponse();
                $model->loadDefaultValues();
                $model->post_id = rand(1, 20);
                $model->user_id = rand(1, 10);
                $model->content = $faker->text(rand(10, 20));
                echo "\n insert mkt_post_response " . ($model->save(false) ? 'ok' : 'err:' . print_r($model->getErrors(), true)) . "\n";
            }

            // 收藏数据
            $this->truncateTable('mkt_collect');
            for ($i = 1; $i <= 50; $i++) {
                $model = new common\models\MktCollect();
                $model->loadDefaultValues();
                $model->post_id = rand(1, 50);
                $model->user_id = rand(1, 50);
                echo "\n insert mkt_collect " . ($model->save(false) ? 'ok' : 'err:' . print_r($model->getErrors(), true)) . "\n";
            }

            // 关注数据 ---------------------------------------
            $this->truncateTable('mkt_follow');
            $flags = [];
            for ($i = 0; $i<100 ; $i++) {
                $model = new common\models\MktFollow;
                $model->loadDefaultValues();
                $model->user_id = rand(1, 10);
                $model->follow_id = rand(1, USER_COUNT);
                if ($model->user_id == $model->follow_id || isset($flags[$model->user_id][$model->follow_id]) ) {
                    continue;
                }
                $flags[$model->user_id][$model->follow_id] = true;
                echo "\n insert mkt_follow " . ($model->save(false) ? 'ok' : 'err:' . print_r($model->getErrors(), true)) . "\n";
            }

            // 好友数据 ---------------------------------------
            $this->truncateTable('mkt_friend');
            $flags = [];
            for ($i = 0; $i<100 ; $i++) {
                $model = new common\models\MktFriend;
                $model->loadDefaultValues();
                $model->user_id = rand(1, 10);
                $model->friend_id = rand(1, USER_COUNT);
                if ($model->user_id == $model->friend_id || isset($flags[$model->user_id * $model->friend_id]) ) {
                    continue;
                }
                $flags[$model->user_id * $model->friend_id] = true;
                if ($model->save(false)) {
                    $model_x = new common\models\MktFriend;
                    $model_x->loadDefaultValues();
                    $model_x->user_id = $model->friend_id;
                    $model_x->friend_id = $model->user_id;
                    echo "\n insert mkt_friend " . ($model_x->save(false) ? 'both ok' : 'half err:' . print_r($model_x->getErrors(), true)) . "\n";
                } else {
                    echo 'both err:' . print_r($model->getErrors(), true) . "\n";
                }
                    
            }

            // 金币 ---------------------------------------
            $this->truncateTable('mkt_gold');
            $flags = [];
            for ($i = 0; $i<100; $i++) {
                $model = new common\models\MktGold;
                $model->loadDefaultValues();
                $model->user_id = rand(1, 20);
                $model->amount = rand(1, 20);
                $model->memo = "memo-{$i}";
                $model->source = rand(0, 2);
                echo "\n insert mkt_gold " . ($model->save(false) ? 'ok' : 'err:' . print_r($model->getErrors(), true)) . "\n";
            }
        }

        return true;
    }

    public function down()
    {
        //$this->dropColumn('mkt_chat', 'cat');
        //$this->dropColumn('mkt_chat', 'approved');

        $this->dropTable('mkt_template_id');

        //删除 资源会员 表
        //$this->dropTable('mkt_source_member');
        //暂时只清除数据不删除表
        $this->truncateTable('mkt_source_member');

        // 场地资源
        $this->truncateTable('mkt_source_room');

        // 礼品资源
        $this->truncateTable('mkt_source_gift');

        // 现金资源
        $this->truncateTable('mkt_source_donate');

        // 推广表
        $this->truncateTable('mkt_source_promotion');

        //服务表
        $this->truncateTable('mkt_source_service');

        //投诉表
        $this->truncateTable('mkt_post_complain');

        //建议表
        $this->truncateTable('mkt_feedback');


        echo "m161012_093257_create_demo_data cannot be reverted.\n";
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}
